home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / binutils / coffgrok.h < prev    next >
C/C++ Source or Header  |  1994-07-15  |  4KB  |  207 lines

  1. #define T_NULL        0
  2. #define T_VOID        1    /* function argument (only used by compiler) */
  3. #define T_CHAR        2    /* character        */
  4. #define T_SHORT        3    /* short integer    */
  5. #define T_INT        4    /* integer        */
  6. #define T_LONG        5    /* long integer        */
  7. #define T_FLOAT        6    /* floating point    */
  8. #define T_DOUBLE    7    /* double word        */
  9. #define T_STRUCT    8    /* structure         */
  10. #define T_UNION        9    /* union         */
  11. #define T_ENUM        10    /* enumeration         */
  12. #define T_MOE        11    /* member of enumeration*/
  13. #define T_UCHAR        12    /* unsigned character    */
  14. #define T_USHORT    13    /* unsigned short    */
  15. #define T_UINT        14    /* unsigned integer    */
  16. #define T_ULONG        15    /* unsigned long    */
  17. #define T_LNGDBL    16    /* long double        */
  18.  
  19.  
  20.  struct coff_reloc
  21.  {
  22.    int offset;
  23.    struct coff_symbol *symbol;
  24.    int addend;
  25.  };
  26.  
  27.  struct coff_section 
  28.  {
  29.    char *name;
  30.    int code;
  31.    int data;
  32.    int address;
  33.    int number;  /* 0..n, .text = 0 */
  34.    int nrelocs;
  35.    int size;
  36.    struct coff_reloc *relocs;
  37.    struct sec *bfd_section;
  38.  };
  39.  
  40. struct coff_ofile
  41. {
  42.   int nsources;
  43.   struct coff_sfile *source_head;
  44.   struct coff_sfile *source_tail;
  45.   int nsections;
  46.   struct coff_section *sections;
  47.   struct coff_symbol *symbol_list_head;
  48.   struct coff_symbol *symbol_list_tail;
  49. };
  50.  
  51. struct coff_isection {
  52.   int low;
  53.   int high;
  54.   int init;
  55.   struct coff_section *parent;
  56. };
  57.  
  58. struct coff_sfile
  59. {
  60.   char *name;
  61.   struct coff_scope *scope;
  62.   struct coff_sfile *next;
  63.  
  64.   /* Vector which maps where in each output section
  65.      the input file has it's data */
  66.   struct coff_isection *section; 
  67.  
  68. };
  69.  
  70.  
  71.  struct coff_type
  72. {
  73.   int size;
  74.   enum
  75.     {
  76.       coff_pointer_type, coff_function_type, coff_array_type, coff_structdef_type, coff_basic_type,
  77.       coff_structref_type, coff_enumref_type, coff_enumdef_type, coff_secdef_type
  78.       } type;
  79.   union
  80.     {
  81.       struct 
  82.     {
  83.     int address;
  84.     int size;
  85.       } asecdef;
  86.  
  87.       struct
  88.     {
  89.       int isstruct;
  90.       struct coff_scope *elements;
  91.       int idx;
  92.     }
  93.       astructdef;
  94.       struct
  95.     {
  96.       struct coff_symbol *ref;
  97.     } astructref;
  98.  
  99.       struct
  100.     {
  101.       struct coff_scope *elements;
  102.       int idx;
  103.     } aenumdef;
  104.       struct
  105.     {
  106.       struct coff_symbol *ref;
  107.     } aenumref;
  108.  
  109.       struct
  110.     {
  111.       struct coff_type *points_to;
  112.     } pointer;
  113.       struct
  114.     {
  115.       int dim;
  116.       struct coff_type *array_of;
  117.     } array;
  118.  
  119.       struct
  120.     {
  121.       struct coff_type *function_returns;
  122.       struct coff_scope *parameters;
  123.       struct coff_scope *code;
  124.       struct coff_line *lines;
  125.     } function;
  126.       int basic;        /* One of T_VOID.. T_UINT */
  127.     }  u;
  128. };
  129.  
  130.  
  131.  struct coff_line 
  132.  {
  133.    int nlines;
  134.    int *lines;
  135.    int *addresses;
  136.  };
  137.  
  138.  
  139.  struct coff_scope
  140.    {
  141.      struct coff_section *sec; /* What section */
  142.      int offset; /* where */
  143.      int size; /* How big */
  144.      struct coff_scope *parent;    /* one up */
  145.  
  146.      struct coff_scope *next;    /*next along */
  147.  
  148.      int nvars;
  149.  
  150.      struct coff_symbol *vars_head;    /* symbols */
  151.      struct coff_symbol *vars_tail;
  152.  
  153.      struct coff_scope *list_head;    /* children */
  154.      struct coff_scope *list_tail;
  155.  
  156.    };
  157.  
  158.  
  159.  struct coff_visible
  160.    {
  161.      enum coff_vis_type
  162.        {
  163.      coff_vis_ext_def,
  164.      coff_vis_ext_ref,
  165.      coff_vis_int_def,
  166.      coff_vis_common,
  167.      coff_vis_auto,
  168.      coff_vis_register,
  169.      coff_vis_tag,
  170.      coff_vis_member_of_struct,
  171.      coff_vis_member_of_enum,
  172.      coff_vis_autoparam,    
  173.      coff_vis_regparam,
  174.        } type;
  175.    };
  176.  
  177.  struct coff_where
  178.    {
  179.      enum
  180.        {
  181.      coff_where_stack, coff_where_memory, coff_where_register, coff_where_unknown,
  182.      coff_where_strtag, coff_where_member_of_struct,
  183.      coff_where_member_of_enum, coff_where_entag, coff_where_typedef
  184.  
  185.        } where;
  186.      int offset;
  187.      int bitoffset;
  188.      int bitsize;
  189.      struct coff_section *section;
  190.    };
  191.  
  192.  struct coff_symbol
  193.    {
  194.      char *name;
  195.      int tag;
  196.      struct coff_type *type;
  197.      struct coff_where *where;
  198.      struct coff_visible *visible;
  199.      struct coff_symbol *next;
  200.      struct coff_symbol *next_in_ofile_list; /* For the ofile list */
  201.      int number;
  202.      int er_number;
  203.      struct coff_sfile *sfile;
  204.   };
  205.  
  206. struct coff_ofile *coff_grok();
  207.